//
//  RequestData.m
//  storyBoardHomeWork
//
//  Created by lanou3g on 15/6/30.
//  Copyright (c) 2015年 蓝欧科技. All rights reserved.
//

#import "RequestData.h"

@implementation RequestData

- (void)requestWithUrl:(NSString *)url {
//1.创建对象
    NSURL *reqUrl = [NSURL URLWithString:url];
//2.创建请求对象
    NSURLRequest *request = [NSURLRequest requestWithURL:reqUrl];
//3.发送异步请求
    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        if (data) {
            [_delegate requestSuccess:data];
        }
        if (connectionError) {
            [_delegate requestError:connectionError];
        }
    }];
}




@end
